<li class="layui-nav-item layui-hide-xs addon-note" lay-unselect>
	<a href="javascript:;">
		<i class="layui-icon layui-icon-note"></i>
	</a>
</li>


<script>


	layui.define('view', function(exports){
		var $ = layui.jquery,view = layui.view,$win = $(window), $body = $('body'),admin = {
			screen: function(){
				var width = $win.width();
				if(width > 1200){
					return 3; //大屏幕
				} else if(width > 992){
					return 2; //中屏幕
				} else if(width > 768){
					return 1; //小屏幕
				} else {
					return 0; //超小屏幕
				}
			}
		};

		var value = "{present name='addon_site_note'}{$addon_site_note.content}{/present}";

		$('.addon-note').click(function(){
			var mobile =  admin.screen() < 2;
			view.popup({
				title: '便签'
				,shade: 0
				,offset: [
					'41px'
					,(mobile ? null : ($(this).offset().left - 250) + 'px')
				]
				,anim: -1
				,id: 'LAY_adminNote'
				,skin: 'layadmin-note layui-anim layui-anim-upbit'
				,content: '<textarea placeholder="内容"></textarea>'
				,resize: false
				,success: function(layero, index){
					var textarea = layero.find('textarea');

					textarea.val(value).focus().on('keyup', function(){
						// 保存
						value = this.value;
						$.post("{:addon_url('note://Note/save')}", {content:this.value,module:'{$module}'}, function (res) {
						}, 'json')
					});
				}
			});
		});

	});
</script>

